package com.zhonghui.mapper;

import com.zhonghui.annotation.AutoFill;
import com.zhonghui.enumeration.OperationType;
import com.zhonghui.model.Cart;
import com.zhonghui.vo.CartProductVo;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author: FL
 * @create: 2024 2024/5/11 14:58
 */
@Mapper
public interface CartMapper {
    /**
     * 根据id获取购物车信息
     */
    Cart getCartById(Long id);

    /**
     * 获取购物车列表
     * @return
     */
    List<Cart> getCartList(Long userId);

    @AutoFill(value = OperationType.INSERT)
    Integer addCart(Cart cart);

    @AutoFill(value = OperationType.UPDATE)
    Integer updateCart(Cart cart,Long id);

    Integer deleteCart(Long id);

    Integer clearCart(Long userId);

    Cart getCartByProductId(Long userId,Long productId);
}
